from django.shortcuts import get_object_or_404
from orders.models import Restaurant, MenuItem

class RestaurantService:
    @staticmethod
    def get_all_restaurants():
        """Get all active restaurants."""
        return Restaurant.objects.all()

    @staticmethod
    def get_restaurant_with_menu(restaurant_id):
        """Get restaurant and its available menu items."""
        restaurant = get_object_or_404(Restaurant, pk=restaurant_id)
        menu_items = MenuItem.objects.filter(
            restaurant=restaurant,
            is_available=True
        ).select_related('restaurant')
        return restaurant, menu_items